#!/usr/bin/evn python

gain_accepted = open('gain_accepted.csv', 'w')
gain_rejected = open('gain_rejected.csv', 'w')

with open('stats', 'r') as reader:
    for line in reader:
        line = line.strip()
        est, act, accepted = line.split('\t')
        accepted = int(accepted)

        nline = est + '\t' + act + '\n'
        if (accepted == 1):
            gain_accepted.write(nline)
        else:
            gain_rejected.write(nline)

gain_accepted.close()
gain_rejected.close()

